home *** CD-ROM | disk | FTP | other *** search
/ Java 1996 August / Java - Summer 1996.iso / Linux / HOWTO / java-linux-HOWTO.2.0.sgml < prev    next >
SGML Document  |  1996-01-22  |  31KB

  1. <!-- This is the Java on Linux HOWTO, SGML source -- >
  2. <!-- Eric S. Raymond, esr@snark.thyrsus.com -- >
  3. <!-- The submission address is gregh@sunsite.gatech.edu -- >
  4. <!-- Updates should also go to karl@ncm.com and chapman@u.washington.edu --> 
  5.  
  6. <!doctype linuxdoc system>
  7.  
  8. <article>
  9.  
  10. <title>Java on Linux HOWTO
  11. <author>maintained by Eric S. Raymond,
  12. <htmlurl url="mailto:esr@snark.thyrsus.com" name="<esr@snark.thyrsus.com>"> 
  13. <date>v.2.0, 20 Jan 1996
  14.  
  15. <abstract>
  16. This document describes how to get started with Java and HotJava under
  17. Linux, as either a user or a programmer.
  18. </abstract>
  19.  
  20. <toc>
  21.  
  22. <sect>Introduction
  23. <p>
  24. This document is a Linux-centric introduction to the world of Java and
  25. HotJava.  These technologies are rapidly evolving, and we welcome
  26. contributions from anywhere.
  27. <p>
  28. Places in this document that are in serious need of checking or filling out
  29. are bracketed with *** ***.  Also see the <ref id="needed" name="To Be
  30. Added..."> section below.  Please help us improve this HOWTO.  Send updates
  31. and change requests to 
  32. <htmlurl url="mailto:esr@snark.thyrsus.com" name="<esr@snark.thyrsus.com>">.
  33. </sect>
  34.  
  35. <sect> General Questions About Java and HotJava
  36. <p>
  37. This section is a general (non-Linux-specific) introduction to Java and 
  38. HotJava.
  39.  
  40. <sect1> What are are Java and HotJava and why are they interesting?
  41. <p>
  42. Java is a network-aware language superficially resembling C++, but much
  43. smaller and more compact and cleanly designed.  It's an unlimited-extent
  44. language with garbage collection like Lisp, but with static type checking
  45. (it's been aptly described as "Smalltalk with sane syntax").  It includes
  46. lightweight processes (threads) as a native facility and has powerful
  47. network-security features.  So far, its major application is the HotJava
  48. browser, but it holds considerable promise as a general-purpose application
  49. language.
  50.  
  51. HotJava is a WWW browser written in Java.  Its major advance over
  52. other browsers is that it knows about a new HTML construct called an
  53. APPLET, which is some Java class that executes on the client machine.
  54. Thus, WWW documents written with Java in mind can have "live" code
  55. objects embedded in them, as opposed to just data.
  56.  
  57. The ability to safely pass around code objects probably represents the most
  58. significant advance in WWW technology since the first release of Mosaic.
  59. At minimum, it delivers an extensible Web browser that won't need
  60. perpetual upgrading to handle new image formats and tag types.
  61. </sect1>
  62.  
  63. <sect1> Where do Java and HotJava come from?  Who can use them?
  64. <p>
  65. Java and HotJava were developed at Sun Microsystems by a team headed 
  66. by James Gosling (well known as the designer of Gosling Emacs and
  67. NeWS).
  68.  
  69. The last time Sun tried to set a major technical standard was NeWS,
  70. its Network Window System.  Though NeWS was pretty universally
  71. conceded to be technically superior to X, X won because its sources
  72. were freely redistributable.  Sun learned from this mistake, and has
  73. made Java/HotJava much more generally available; the sources can be
  74. downloaded under a fairly relaxed license (see <ref id="license"
  75. name="Java as Freely Redistributable Software">).  Sun is
  76. encouraging ports to non-Sun environments.
  77.  
  78. Netscape now interprets Java.  Microsoft licensed the technology in
  79. early December 1995.  So it appears that Java support will probably
  80. become universal in 1996.
  81.  
  82. Java used to be called Oak.  HotJava was once known as WebRunner.
  83. </sect1>
  84.  
  85. <sect1> How mature is Java?
  86. <p>
  87. On December 12 1995 Sun released the `Beta 2' version of Java.  The Java
  88. environment API defining its access to the host OS and windowing system has
  89. allegedly been semi-frozen -- it may be extended, but won't be incompatibly
  90. changed.
  91.  
  92. The 1.0 version of this FAQ is being issued along with the beta 1.0 
  93. Java Developer's Kit (JDK) for Linux, ported by Randy Chapman.
  94.  
  95. Significant holes are known to exist in the Java security
  96. implementation.  It is not yet a good idea to use Java for sensitive
  97. applications.  These problems are expected to be fixed in the production
  98. (post-beta) releases.
  99. </sect1>
  100.  
  101. <sect1> Where can I find documentation on Java and HotJava?
  102. <p>
  103. Sun maintains an extensive HTML web of Java and HotJava-related
  104. documents at <url url="http://java.sun.com">.  These documents are 
  105. mirrored at <url url="http://java.blackdown.com"> and elsewhere; see
  106. Sun's list of mirror sites.
  107. </sect1>
  108.  
  109. <sect1>Yes, but where can I find paper documentation?
  110. <p>
  111. SunSoft Press's official series of Java books is in the production pipeline at
  112. Addison-Wesley.  Some details about these can be found in the
  113. <url url="http://www.city-net.com/~krom/java-faq.html"
  114. name="comp.lang.java FAQ">.
  115.  
  116. Several Java early-adopters have recommended "Hooked on Java" by the
  117. members of the Java team.  "Well written, though I'd appreciate something
  118. less basic" was one comment.
  119.  
  120. O'Reilly Associates is working on its own series of Java books in
  121. cooperation with Sun.  These will include (at least) a
  122. "Nutshell Guide To Java", a language reference, a class library
  123. reference, and a book on the underlying byte-code virtual machine.
  124. (Full-disclosure statement: Your HOWTO editor has been invited by
  125. O'Reilly Associates to serve as primary technical reviewer for this
  126. series, and is being paid for that work.)
  127.  
  128. SAMS has a book called "Learning Java in 21 Days".  No revieww yet.
  129.  
  130. One of our contributors, browsing his local Bookstop/Barnes \&
  131. Noble/Borders, came up with 3 books already out:
  132. <itemize>
  133.     <item>One called 'Java in 60 minutes' that looked like a pretty
  134.         strict syntactic description (about \$20).
  135.     <item>One from SamsNet called just `Java' (about \$20).
  136.     <item>One by Tim Ritchey called `Java!' that includes a
  137.         CD-ROM (about \$35).
  138. </itemize>
  139. Our informant continues: "I bought the 3rd one (by Tim Ritchey). Paper
  140. leadtimes being what they are, the CD-ROM only has alpha stuff, though it
  141. mentions that the beta version might be out by the time you read it and
  142. suggests java.sun.com as a place to get more recent information.  Other
  143. than that, it's pretty good, even to pointing out that `well, it's
  144. pointless for me to spam you with pages and pages of API descriptions
  145. because 1) it would quadruple the size of the book and 20 they're still ch
  146. anging and 2) you can get that info online at ...etc'"
  147.  
  148. Dave Dittrich writes: I'd say that "Java in 60 minutes" may take you 60
  149. minutes to read, but won't teach you how to program in Java in 60 minutes
  150. (surprise, surprise!)  It looks to me like "Java in 60 minutes" is one of
  151. the many attempts be first to market with a book on a hot topic.  It didn't
  152. seem to include much more than you can find right now on the Web, including
  153. lots of text that looks like it was lifted straight out of the Java
  154. Language Specification (http://java.sun.com/JDK-beta2/psfiles/javaspec.ps).
  155.  
  156. Dave continues: Same thing with "Java!", only the latter goes into much
  157. more detail on object oriented programming concepts, etc.  Someone pointed
  158. me to another text book that is equally as good at covering data/method
  159. abstraction and other object oriented programming concepts, which is
  160. "Structure and Interpretation of Computer Programs" by Abelson, Sussman and
  161. Sussman (MIT Press).
  162.  
  163. Final caveat: at this point (January 1996), it is probly a good idea to
  164. stay away from the Ritchey book or anything else based on the alpha API.
  165. The beta API is substantially different, and the soon-to-be-released Java
  166. 1.0 will have its own differences.
  167. </sect1>
  168.  
  169. <sect1> Where can I find on-line collections of Java code?
  170. <p>
  171. WWW archives of applets are available at the following locations:
  172. <itemize>
  173.     <item><url url="http://java.sun.com/">
  174.     <item><url url="http://www.applets.com/">
  175.     <item><url url="http://www.gamelan.com/">
  176.     <item><url url="http://www.javasoft.com/applets/applets.html">
  177. </itemize>
  178. Most of the applets on these pages come with source code, and programmers
  179. are invited to use them.
  180.  
  181. Pointers to others may be available in the
  182. <url url="http://www.city-net.com/~krom/java-faq.html"
  183. name="comp.lang.java FAQ">.
  184. </sect1>
  185. </sect>
  186.  
  187. <sect> Java as Freely Redistributable Software <label id="license">
  188. <p>
  189. Many Linux programmers are attached to producing freely redistributable 
  190. software (FRS), and try to avoid committing a lot of time to tools for
  191. which sources are not generally available.  In this section, we discuss
  192. Sun's and Java's relationship with the FRS world.
  193.  
  194. (Warning: I am not a lawyer.  I am neither employed by, nor an agent of,
  195. nor a stockholder in, Sun Microsystems.  This section is based on my
  196. interpretation of the current copyright law and the Sun licensing language.
  197. Treat this as an introduction; the Sun licensing page, <url
  198. url="http://www.blackdown.org/Java/licensing.html"> is definitive. If you are
  199. in serious doubt about what it means, consult an attorney.)
  200.  
  201. <sect1> Are Java programs and applets freely redistributable?
  202. <p>
  203. They are if you write them and choose to make them FRS through some
  204. mechanism (such as the GPL, or a BSD-style license, or declaring them
  205. public domain).
  206.  
  207. <sect1> What can I do with Java implementation binaries?
  208. <p>
  209. The Sun licensing page has this to say:
  210. <quote>
  211. The unmodified Java and HotJava binary releases may be redistributed free
  212. of charge in both commercial and non-commercial applications.
  213. </quote>
  214. Also:
  215. <quote>
  216. Companies or individuals who wish to create a new port of the Java
  217. language have the right under this agreement to post the binaries
  218. of that port to the Internet for use by others, as long as the    
  219. port is free of charge and passes the publicly available test          
  220. suites. (Test suites will be available sometime in the first half      
  221. of 1996.) The "diffs" may also be posted on the web as long as the     
  222. underlying source code is not posted. The Java source code is          
  223. </quote>
  224. So if you've got a working Java or HotJava binary, you can give it to your
  225. buddies.  Or put it on a CD-ROM.  Or do anything except patch it and
  226. represent the patched version as Java.  (This is reasonable.  Sun obviously
  227. can't leave itself without recourse against Trojan horses sailing under the
  228. Java banner.)  Binaries are FRS.
  229. </sect1>
  230.  
  231. <sect1> Which parts of the Java sources are freely redistributable?
  232. <p>
  233. According to Sun's licensing page, none of it is.  But that sounds harsher
  234. than it is.  In practice, anyone can get the Java and HotJava sources for
  235. educational, porting, and non-commercial purposes by filling out a Web form
  236. which obligates them not to redistribute the sources.  And the agreement
  237. <em/does/ permit redistribution of diffs against the sources.
  238.  
  239. The only circumstance that requires you to sign a commercial license with
  240. Sun and pay them money is if you want to use the sources in a commercial
  241. product.  In particular, the way the language is written, it's within the
  242. letter and spirit of the agreement for you to sign Sun's noncommercial
  243. source license, snarf the source, port it, and give away the resulting
  244. binaries as completely unencumbered freeware!
  245.  
  246. Sun says that its primary purpose in keeping as much control as it has
  247. is to keep the language from mutating into incompatible dialects.  The
  248. license language supports this; it seems to have been designed to allow
  249. hackers to play for free.
  250. </sect1>
  251.  
  252. <sect1> What is Sun's attitude towards FRS Java implementations and tools?
  253. <p>
  254. The Sun licensing page says:
  255. <quote>
  256. The specifications for the Java Language and the Java Virtual Machine are
  257. OPEN and are copyrighted by Sun Microsystems, Inc.
  258. </quote>
  259. <quote>
  260. Reimplementations of the Java Compiler or the Java Runtime Interpreter
  261. are permitted without requiring a license from Sun provided such      
  262. implementations are created directly from the published specifications     
  263. and without the direct or indirect use of Sun's own implementations or     
  264. other intellectual property rights, including trademarks.                  
  265. </quote>
  266. So if you want to go to the effort of creating a Java clone from the
  267. published specifications that is FRS, Sun won't stop you.
  268. <p>
  269. Sun people use the term "rogue port" for Java implementations that either
  270. (a) are performed outside Sun, or (b) don't rely on Sun-licensed code
  271. (sometimes the term seems to mean one thing, sometimes the other).  They
  272. seem to think some of these already exist, but we don't know where they
  273. are, nor if they are FRS.  They're pretty relaxed about the situation.
  274. <p>
  275. Sun has a Java validation suite.  They have said they'll certify any Java
  276. port that passes it.  (Whether this validation will cost money is unknown,
  277. but Sun says in writing that the suite wil be "publicly available" in 1996,
  278. which at least hints that it will not.) They're prepared to certify rogue
  279. ports, though this apparently hasn't happened yet.
  280. </sect1>
  281.  
  282. <sect1> Is anyone cloning Java in freely redistributable source?
  283. <p>
  284. There is a clone of the Java compiler in early development.  It's
  285. called guavac.  You can find more information at
  286. <url url="http://http.cs.berkeley.edu/~engberg/guavac">
  287.  
  288. There is a rumor afloat that Cygnus Software's GROW project has plans for
  289. a Java byte code interpreter to be issued under GPL.  However, they haven't yet
  290. responded to a query about this.  You can get details on the GROW project at
  291. <url url="http://www.cygnus.com/tiemann/grow/">.
  292.  
  293. Erik Troan of Red Hat is attempting to put together a development group to
  294. do the rest of the job.  Right now it looks like Erik will do the class
  295. library and your humble editor will do the byte-code interpreter (if Cygnus
  296. hasn't gotten there first).  This project has been tentatively named
  297. "Mr. Coffee".  Your editor would now prefer to call it "joe" (for Java Open
  298. to Everyone) but that name is taken.
  299.  
  300. <sect1> Are there any FRS Java Tools?
  301. <p>
  302. There is a GNU Emacs mode for editing Java.  You can fetch it from
  303. <url url="ftp://java.sun.com/pub/java/contrib/emacs">.  Note: this
  304. mode assumes you're using c++-mode.el, and won't work with the cc-mode.el
  305. distributed with Emacs 19.
  306. </sect1>
  307. </sect>
  308.  
  309. <sect> Java On Linux Questions
  310. <p>
  311. Here you can learn the nuts and bolts of getting Java running on your Linux.
  312.  
  313. <sect1> Are Java and HotJava included in any of the Linux distributions?
  314. <p>
  315. No, not yet, but expect it any week now.
  316. </sect1>
  317.  
  318. <sect1> How can I get the latest Java distribution for Linux?
  319. <p>
  320. Look in <url url="ftp://java.blackdown.org/pub/Java/linux">.  The latest
  321. Java-for-Linux can be downloaded from there.  You should browse
  322. the <url url="ftp://java.blackdown.org/pub/Java/linux/README"> first.
  323.  
  324. The files you'll need are linux.jdk.common.tar.gz and one of either 
  325. linux.jdk.x86-static-motif-bin.tar.gz ot linux.jdk.x86-shared-motif-bin.tar.gz,
  326. depending on whether you have Motif shared libraries on your system.
  327.  
  328. This port (from the Sun sources by Randy Chapman) is the one that's referred to
  329. (as the JDK) elsewhere in this HOWTO.
  330. </sect1>
  331.  
  332. <sect1> What environment will I need to run Java?
  333. <p>
  334. For starters, you need an ELF-based Linux.  There is no a.out support,
  335. and at the speed the Linux world is switching over to ELF there is not
  336. likely to be any in the future.
  337. <p>
  338. You need a 1.2.13 or later kernel.  Kernels 1.2.12 and older seem to have a
  339. bug in getcwd(3) that tanks bin/javac because it doesn't check the
  340. getcwd(3) return code.
  341. <p>
  342. You'll need these pieces:
  343.  
  344. <itemize>
  345.     <item>libc.so.5 => /lib/libc.so.5.2.16 &nl
  346.         (The standard C library)
  347.  
  348.     <item>libX11.so.6 => /usr/X11/lib/libX11.so.6.0 &nl
  349.         (The base X11R6 library)
  350.  
  351.     <item>libXt.so.6 => /usr/X11/lib/libXt.so.6.0 &nl
  352.         (The Athena toolkit library)
  353.  
  354.     <item>libXext.so.6 => /usr/X11/lib/libXext.so.6.0 &nl
  355.         (The X extensions library)
  356.  
  357.     <item>libXpm.so.4 => /usr/X11/lib/libXpm.so.4.3  &nl
  358.         (The X library for pixmap handling.)
  359.  
  360.     <item>libdl.so.1 => /lib/libdl.so.1.7.9 &nl
  361.         (Linux dynamic-loader support)
  362. </itemize>
  363. The C and X support libraries may be in your Linux already.
  364. <p>
  365. If you don't already have it, get libc.5.2.16.bin.tar.gz from
  366. <url url="ftp://tsx-11.mit.edu/pub/linux/packages/GCC/">.
  367. Uncompress and untar and copy the files in the lib subdirectory
  368. of the top level of the hierarchy to /lib.
  369.  
  370. If you don't have a current version of ld.so (or libdl.so.1.7.*) you
  371. will need to update. ld.so.1.7.9 and .11 will work; .10 and other early
  372. versions will not. Get ld-so.1.7.11.tar.gz from
  373. <url url="ftp://ftp.ods.com/linux/">;
  374. Uncompress and untar it and run <em/instldso.sh/ which is
  375. in the top level of the resulting hierarchy.
  376.  
  377. You can get an Xpm library that will work from 
  378. <url url="ftp://sunsite.unc.edu/pub/Linux/libs/X/libXpm.3.4f-ELF.tar.gz">.
  379. </sect1>
  380.  
  381. <sect1> Do I need Netscape?  Can I use Netscape?
  382. <p>
  383. Yes, you need Netscape.  HotJava isn't yet available for the beta release.
  384. Randy Chapman says:
  385. <quote>
  386. Sun massively changed the awt interface when they shipped the
  387. beta JDK and have not yet converted HotJava to it.  They have promised
  388. they will, and it should work great with linux-jdk when they release it.
  389. </quote>
  390. It's unknown when this will happen.
  391. <p>
  392. Netscape versions starting from 2.0b3 is Java-aware.
  393. It is available at ftp[1-7].netscape.com (i.e. at ftp1.netscape.com,
  394. ftp2.netscape.com,... etc.)  Version 2.0b4 will allow you to read applets from file: URLs,
  395. 2.0b3 didn't.  This should be a big help for folks with small-memory
  396. machines (they don't need an httpd running).
  397.  
  398. The file to get is 
  399. /2.0b4/unix/netscape-v20b4-export.i486-unknown-linux.tar.Z.
  400. <p>
  401. Note that Netscape 2.0b3 or 4 will run on an a.out system, so it is, in theory,
  402. possible to write your java app, give it to someone else to compile (like
  403. maybe the <url url="http://mars.blackstar.com" name="BlackStar Public
  404. Compiler">), and see the output on your system.  If you want more than
  405. that, get an ELF system.
  406.  
  407. Make sure CLASSPATH is <em/not/ set before running netscape; having
  408. it set seems to crash Netscape, and if you follow the directions below it
  409. won't need tweaking.
  410.  
  411. The Linux Netscape port has a few known problems.  It doesn't do sound.
  412. Only 8-bit displays work; 16bpp displays yield crashes.  The 2.0b3 version
  413. occasionally yields bus errors when caling the dispose method for frames.
  414. While it's pretty robust otherwise, Gamelan's `Impressionism' applet is
  415. known to crash it.
  416. </sect1>
  417.  
  418. <sect1> What mailing lists or newsgroups exist for supporting Java on Linux?
  419. <p>
  420. <itemize>
  421. <item><em/java-linux/ (Maintained by karl@blackdown.org)
  422.         Discussions and developments concerning the port of Java to the
  423.         Linux operating system. Email to
  424.     <htmlurl url="mailto:java-linux-request@java.blackdown.org"
  425.         name="java-linux-request@java.blackdown.org">
  426.     with the word `subscribe' in the subject to be added to the list.
  427. <item><em/java-linux-announce/ (Maintained by karl@blackdown.org)             
  428.     Moderated list for announcements concerning the Java-Linux           
  429.     porting projects. Please send e-mail to
  430.     <htmlurl url="mailto:java-linux-announce-request@java.blackdown.org"
  431.         name="java-linux-announce-request@java.blackdown.org">
  432.     with the word subscribe in the subject, to be added to the list.
  433. <item><htmlurl url="news:comp.lang.java" name="comp.lang.java">
  434.     Newsgroup for general Java discussion.
  435. <item><htmlurl url="news:alt.www.hotjava" name="alt.www.hotjava">
  436.     Newsgroup for discussion of the HotJava browser.
  437. </itemize>
  438. </sect1>
  439. </sect>
  440.  
  441. <sect> Building the Linux Java port on stock Linuxes
  442. <p>
  443. In this section, we collect recipes sent to us for building Randy Chapman's
  444. Java port on various current Linux distributions:
  445.  
  446. <sect1> Slackware distribution ELF kernel 1.2.13.
  447. <p>
  448. John Franks <john@math.nwu.edu> writes that he succeeded with the
  449. following steps: 
  450.  
  451. <itemize>
  452.     <item>Get linux-x86.jdk.pre2.static-motif.tar.gz from 
  453.         <url url="ftp://www.blackdown.org/pub/Java/linux/">
  454.         and uncompress it and untar it.  (The filenames you must fetch
  455.         have changes for the 1.0 beta JDK.)
  456.  
  457.     <item>Get libc.5.2.16.bin.tar.gz (binary distribution, not source) from
  458.         <url url="ftp://tsx-11.mit.edu/pub/linux/packages/GCC/">
  459.         Uncompress and untar and copy the files in the lib subdirectory
  460.         of the top level of the hierarchy to /lib.  Make sure
  461.         that /lib/libc.so.5 is a symlink to this file.
  462.  
  463.     <item>Get ld-so.1.7.11.tar.gz from ftp://ftp.ods.com/linux/
  464.         Uncompress and untar it and run "instldso.sh" which is
  465.         in the top level of the resulting hierarchy.
  466. </itemize>
  467. You should now be able to compile and try the "hello world" program
  468. and applet from Sun following the instructions at <url
  469. url="http://java.sun.com/progGuide/index.html">.
  470. </sect1>
  471.  
  472. <sect1> RedHat 2.1/Caldera Preview 2
  473. <p>
  474. Steve Greene <sgreene@access.digex.net> reports success doing
  475. the following steps.  I have edited the recipe slightly, so blame any
  476. mistakes on me.  The `JDK' he refers to is the Chapman port of the
  477. Java Developer's Kit.
  478.  
  479. <itemize>
  480.     <item>From a Red Hat mirror site, get the rpm available for 
  481.         ld.so.1.7.11.  To find it, check any RedHat mirror site for:
  482.  
  483.         /pub/mirrors/redhat-2.1/updates/RPMS/ld.so-1.7.11-i386.rpm
  484.  
  485.         I know it is available at ftp.pht.com, ftp.caldera.com. and is 
  486.         probably at the other RedHat mirrors as well.  Grab it, and
  487.         do `rpm -Uvh ld.so-1.7.11-1.i386.rpm' on your system.
  488.  
  489.     <item>Red Hat 2.0 and Caldera Preview 2 users may need the `which' 
  490.         program (it's called by some of the scripts in the JDK). 
  491.         An rpm file for `which' is available at the usual Red Hat
  492.         mirror sites as part of the Red Hat 2.1 distribution files.
  493.         Get and install which-1.0.i386.rpm.  RedHat 2.1 users
  494.         should already have which on their system or available
  495.         within their original distribution.
  496.  
  497.     <item> Get the tar file(s) for the statically-linked JDK.
  498.         Untar it from a convenient point.  I put mine in 
  499.         /usr/local, so the untar creates /usr/local/java/....
  500.  
  501.     <item> So you can run java as someone other than root (this is a
  502.         good idea!), do `chmod 666 /dev/zero'.   Red Hat and Caldera
  503.         have the wrong permissions set on this device out of the box.
  504.  
  505.     <item> If you haven't already, run ldconfig as root to load the new 
  506.         libraries.  If you do "ldconfig -v"  you can verify you have 
  507.         all the libraries loaded.  (At least we don't have to build
  508.         an ELF system first!)
  509.  
  510.     <item> Make sure you're logged in as a user (e.g. non-root).  Start X-
  511.         windows, open an X-Term, and try something!
  512. </itemize>
  513. </sect1>
  514.  
  515. <sect1> Unifix
  516. <p>
  517. Stefan Middendorf writes: Unifix is a popular German-language Linux
  518. distribution. There are a few distributions based on it: Linux Universe,
  519. sold in USA, Linux 4U, currently only distributed in Germany and Linux FT
  520. in Britain.  This recipe is known to work for Unifix 1.7, Linux 4U 1st
  521. Edition, Linux Universe 2nd Edition, and Linux FT 1.1.
  522.  
  523. <itemize>
  524. <item>Put linux-x86.jdk.pre2.static-motif.tar.gz from
  525.     <url url="ftp://www.blackdown.org/pub/Java/linux/">
  526.     in /usr/local and uncompress it and untar it.
  527.  
  528. <item>Change the first line of the script .java_wrapper
  529.       from PRG=`which \$0` >/dev/null 2>\&1 to
  530.  
  531.     PRG=`type \$0 | cut -d ' ' -f 3` >/dev/null 2>\&1
  532.  
  533. <item>Get libc-5.2.18.bin.tar.gz (I succeeded with libc-5.2.16.bin.tar.gz,
  534.     too), extract and uncompress it in the / drectory.
  535.  
  536. <item>Get ld-so.1.7.12.tar.gz from tsx-11.mit.edu (or any mirror site)
  537.     and uncompress and untar it, e.g. in /usr/local.  Change to the
  538.     resulting directory and run instldso.sh. This will also run ldconfig.
  539.     Probably newer versions of ld-so will work too.
  540.  
  541. <item>Add /usr/local/java/bin to the PATH environment variable.
  542.  
  543. <item>Get netscape-v20b4-export.i486-unknown-linux.tar.Z,
  544.     extract and uncompress it in /usr/local/<yourNetscapeDir>.
  545.  
  546. <item>Create a Link in /usr/local/bin to ../<yourNetscapeDir>/netscape. 
  547.  
  548. <item>Put /usr/local/<yourNetscapeDir>/moz2_0.zip in /usr/local/lib/netscape/.
  549. </itemize>
  550.  
  551. As an alternative to changing your PATH, Ralf Strobel suggests:
  552.  
  553. <itemize>
  554. <item> Copy the scripts .java_wrapper and appletviewer and the links @java
  555. @javac, @javadoc, @javap, and @jdb from /usr/local/java/bin to /usr/local/bin
  556. and you can use them wherever you are.
  557.  
  558. <item>In /java/bin/i586 you can add a script called `javadoc`
  559.  
  560.     #!/bin/sh
  561.     `dirname \$0`/java sun.tools.javadoc.Main -d <yourhtmldir> \$*
  562.  
  563.     where if you are user jrandom, <yourhtmldir> would be
  564.     ~jrandom/.java-html.
  565. </itemize>
  566. </sect1>
  567. </sect>
  568.  
  569. <sect> Viewing Applets
  570. <p>
  571. To run a demo without going through the applet viewer, you can enter this
  572. command from the top of my Java directory tree (/usr/local/java on most
  573. systems):
  574.  
  575.      bin/java sun.applet.AppletViewer demo/<directory_name>/exampleN.html
  576.  
  577. where <directory name> is the subdirectory off demo, and N is the 
  578. number of the example file (some directories have more than one).
  579.  
  580. Steve Greene says: I've started the tutorials available from Sun's java
  581. site and the similar one put out by the NTMUG.  I've discovered some
  582. problems with the syntax in Sun's tutorial, so I've been following the
  583. NYMUG tutorial instead for now.
  584.  
  585. The appletviewer expects as an argument, an html file with an
  586. APPLET tag inside it.
  587.  
  588. For example, if your html file Hello.html looks like:
  589.  
  590. <tscreen><verb>
  591.    <HTML>
  592.    <HEAD>
  593.    <TITLE> Hello test program &etago;TITLE>
  594.    < /HEAD>
  595.    <BODY>
  596.    This is an appletviewer test
  597.    <APPLET CODE="Hello1.class" WIDTH=150 HEIGHT=25>
  598.    < /APPLET>
  599.    < /BODY>
  600.    < /HTML>
  601. </verb></tscreen>
  602. (If you see "< /" in the above, ignore the space.  It's a workaround for
  603. a formatter bug.)
  604.  
  605. Running "appletviewer Hello.html" will show you the applet. One advantage
  606. of using the appletviewer is that events sent to the applet (start(),
  607. init(), etc) are in compliance with Sun specs as opposed to Netscape
  608. 2.0b4 (probably a bug in Netscape).
  609.  
  610. A disadvantage of using the appletviewer is that it is much more slower
  611. than Netscape.
  612.  
  613. The first time you run Java, a license screen resembling Netscape's will be
  614. displayed.
  615. </sect>
  616.  
  617. <sect> Notes on Known Problems
  618. <p>
  619. <sect1> GNU Make breaks after I install Java
  620. <p>
  621. Recent versions of libc fix a bug which masked a bug in GNU Make (the
  622. symptom is that make doesn't look in Makefile for rules).  The libc 5.2.8
  623. release notes give a patch to make that fixes the problem.
  624. </sect1>
  625.  
  626. <sect1> You get `dirname: too many arguments' errors 
  627. <p>
  628. Your CLASSPATH variable is not correctly initialized.
  629. In .java_wrapper, there is code akin to the follwing:
  630.  
  631. <tscreen><verb>
  632.    PRG=`which $0`
  633.    J_HOME=`dirname $PRG`/..
  634. </verb></tscreen>
  635.  
  636. Unfortunately, linux's standalone which command is hideously broken, and
  637. certain shells will set \$0 to the full pathname.  Randy Chapman says the
  638. fix is either to use:
  639.  
  640. <tscreen><verb>
  641.     J_HOME=`dirname $0`/..
  642. </verb></tscreen>
  643. Or, safer:
  644.  
  645. <tscreen><verb>
  646.     J_HOME=/usr/local/java
  647. </verb></tscreen>
  648. An alternate fix from Dave Dittrich is:
  649.  
  650. <tscreen><verb>
  651.     PRG=`csh -c "which $0"`
  652. </verb></tscreen>
  653. And another one from Tim Farnum is to change the PRG=`which \$0` line to
  654.  
  655. <tscreen><verb>
  656.     PRG=\$0
  657. </verb></tscreen>
  658. Lutz Behnke suggests:
  659.  
  660. <tscreen><verb>
  661.     PRG=`type -path $0` >/dev/null 2>\&1 
  662. </verb></tscreen>
  663. A similar change also needs to be made to the appletviewer script.
  664. </sect1>
  665.  
  666. <sect1> You get `cannot find class java/lang/Thread' errors 
  667. <p>
  668. Your CLASSPATH variable is not correctly initialized.
  669. See above.
  670. </sect1>
  671.  
  672. <sect1> An error message refers to /dev/zero
  673. <p>
  674. Go root and do `chmod 666 /dev/zero'.
  675. </sect1>
  676.  
  677. <sect1> SEGFAULT
  678. <p>
  679. Occasionally, you may get a screen full of error messages, and the system 
  680. cheerfully fills up your swap space and locks-up.
  681.  
  682. You're probably missing a library someplace.  Rerun ldconfig -v and 
  683. see what's missing. Perhaps LD_LIBRARY_PATH or CLASS_PATH is not set.
  684. Finally, some applets are buggy or lock up the Linux JDK.
  685.  
  686. (BTW, you can stop the lock-up by having another Xterm open 
  687. with top running; use top to kill the java process BEFORE it 
  688. fills up swap and hangs your system!)
  689.  
  690. Java seems to want lots of resources, so I'd keep the number of 
  691. running/open apps on my desktop to a minimum.  It will load on 
  692. a 486DX-2-75 with 8 Mbytes RAM and 16 Mbytes swap (it'll take a 
  693. minute, though).  I was able to get two animation applets running 
  694. simultaneously (sort of) before my system ran out of swap space 
  695. and hung.
  696. </sect1>
  697.  
  698. <sect1> bin/java, bin/javac, or bin/appletviewer gives you a help screen
  699. <p>
  700. You left out some command-line parameter.
  701. </sect1>
  702.  
  703. <sect1> Applets show in the viewer but not when put on a web server
  704. <p>
  705. A common error which causes these results is failing to get the MIME type
  706. of the applet correct.  Your server should send a header with the applet
  707. indicating that its MIME type is "text/plain", "application/octet-stream",
  708. or some other type that doesn't have a defined special handler on the
  709. client side.  How you arrange this depends on which server you are
  710. using. (John Franks)
  711.  
  712. It's also been alleged that tinyhttpd, an HTTP server written in Perl, 
  713. returns a bad content type.  Apache, OTOH, is pretty reliable.
  714. </sect1>
  715.  
  716. <sect1> Problem Logging
  717. <p>
  718. Joey Oravec tells us that HotJava keeps a log of what it does and
  719. any problems in encounters. If you're up to diagnosing something yourself,
  720. look at \$HOME/.hotjava/weblog in the user's home directory.  That file will
  721. make it more obvious if you're perhaps missing a library or something.
  722. </sect1>
  723. </sect>
  724.  
  725. <sect> Related Resources
  726. <p>
  727. For general information on Java, there is a FAQ maintained on the 
  728. <htmlurl url="news:comp.lang.java" name="comp.lang.java">
  729. newsgroup; it is available at
  730. <url url="http://www.city-net.com/~krom/java-faq.html">.
  731. <p>
  732. There is an older FAQ-style document by Joey Oravec
  733. <url url="mailto:joey@sun.science.wayne.edu" name="joey@sun.science.wayne.edu">
  734. which primarily refers to the alpha release.  You can find it at
  735. <url url="http://www.science.wayne.edu/~joey/java/linux.html">.  At some
  736. point these documents may merge.
  737. <p>
  738. Here are some Java-related pages:
  739.  
  740. <itemize>
  741. <url url="http://substance.blackdown.org/java-linux.html" name="Karl Asha's
  742. General Linux Java Page">
  743. <url url="http://homer.ncm.com/java-linux/" name="LinuxJava Mailing List">
  744. <url url="http://www.cs.utexas.edu/users/hiep/netjav.html" name="Netrek for Java">
  745. <url url="http://cirrus.sprl.umich.edu/javaweather/" name="Blue-Skies for Java">
  746. <url url="http://www.parnasse.com/java.shtml" name="Java Hints Page">
  747. </itemize>
  748. </sect>
  749.  
  750. <sect> To Be Added... <label id="needed">
  751. <p>
  752. <itemize>
  753. <item> More recipes for specific Linux variants.
  754. </itemize> 
  755. </sect>
  756.  
  757. <sect> Acknowledgements
  758. <p>
  759. Grateful acknowledgement is made to all contributors, including:
  760. <itemize>
  761. <item>John Franks <john@math.nwu.edu>
  762. <item>Zachary DeAquila <zachary@zachs.place.org>
  763. <item>Steve Greene <sgreene@access.digex.net>
  764. <item>Dave Dittrich <dittrich@cac.washington.edu> 
  765. <item>Dave Flanagan <dave@ora.com>
  766. <item>Joey Oravec <mailto:joey@sun.science.wayne.edu>
  767. <item>Adam Smith <aws@cs.brown.edu>
  768. <item>Joe Buck <jbuck@Synopsys.COM>
  769. <item>Omar Loggiodice <ologgio@netdepot.com>
  770. <item>Stefan Middendorf <mdorf@stud.fh-heilbronn.de<
  771. </itemize>
  772.  
  773. This version incorporates Steve Greene's rumored but never-published
  774. Red Hat/Caldera mini-HOWTO.  I've also swiped some stuff I consider 
  775. useful off Joey Oravec's page -- special thanks to him.
  776.  
  777. For other HOWTOs and FAQs I maintain, see my home page at
  778. <url url="http://www.locke.ccil.org/~esr/home.html">.
  779. </sect>
  780.  
  781. </article>
  782.  
  783. <!--
  784. The following sets edit modes for GNU EMACS
  785. Local Variables:
  786. fill-column:75
  787. End:
  788. -- >
  789.